home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / sgrege_1 / bsscdhtm.js next >
Text File  |  1998-06-23  |  18KB  |  502 lines

  1. // RoboHELP« HTML Edition Dynamic HTML Effects Script
  2. // Copyright ⌐ 1998 Blue Sky Software Corporation.  All rights reserved.
  3.  
  4. // Version=1
  5.  
  6. // Warning:  Do not modify this file.  It is generated by RoboHELP« HTML Edition and changes will be overwritten.
  7.  
  8. function animationContext(el, progressAnimation, finishAnimiation, animationDuration, animationPeriod)
  9. {
  10.     this.el = el;
  11.     this.progressAnimation = progressAnimation;
  12.     this.finishAnimiation = finishAnimiation;
  13.     this.animationDuration = parseFloat(animationDuration);
  14.     this.animationPeriod = animationPeriod;
  15.     this.animationStartTime = (new Date()).getTime();
  16.     this.continueAnimation = true;
  17. }
  18.  
  19. function progressFade(ndx)
  20. {
  21.     percent = ((new Date()).getTime() - animationContexts[ndx].animationStartTime)/animationContexts[ndx].animationDuration;
  22.     if (percent > 1.0)
  23.     {
  24.         percent = 1.0;
  25.         animationContexts[ndx].continueAnimation = false;
  26.     }
  27.     animationContexts[ndx].el.filters.alpha.opacity = animationContexts[ndx].initialOpacity*(1.0-percent) +  animationContexts[ndx].finalOpacity*percent;
  28. }
  29.  
  30. function finishFade(ndx)
  31. {
  32.     animationContexts[ndx].el.filters.alpha.opacity = parseInt(animationContexts[ndx].finalOpacity);
  33. }
  34.  
  35. function progressTranslation(ndx)
  36. {
  37.     percent = ((new Date()).getTime() - animationContexts[ndx].animationStartTime)/animationContexts[ndx].animationDuration;
  38.     if (percent > 1.0)
  39.     {
  40.         percent = 1.0;
  41.         animationContexts[ndx].continueAnimation = false;
  42.     }
  43.     animationContexts[ndx].el.style.pixelLeft = animationContexts[ndx].startX*(1.0-percent) +  animationContexts[ndx].finalX*percent;
  44.     animationContexts[ndx].el.style.pixelTop = animationContexts[ndx].startY*(1.0-percent) +  animationContexts[ndx].finalY*percent;
  45. }
  46.  
  47. function finishTranslation(ndx)
  48. {
  49.     animationContexts[ndx].el.style.pixelLeft = parseInt(animationContexts[ndx].finalX);
  50.     animationContexts[ndx].el.style.pixelTop = parseInt(animationContexts[ndx].finalY);
  51. }
  52.  
  53. var animationContexts = new Array();
  54. var BSSCSequenceIndex = 0;
  55.  
  56.  
  57. function animationPump(ndx)
  58. {
  59.     animationContexts[ndx].progressAnimation(ndx);
  60.     if (animationContexts[ndx].continueAnimation)
  61.         animationContexts[ndx].tm = setTimeout("animationPump(" + ndx + ");", animationContexts[ndx].animationPeriod);
  62. }
  63.  
  64. function clearAnimations()
  65. {
  66.     for (index=0; index<animationContexts.length; index++)
  67.     {
  68.         animationContexts[index].finishAnimiation(index);
  69.         clearTimeout(animationContexts[index].tm);
  70.     }
  71.     animationContexts = new Array();
  72. }
  73.  
  74. function startNextAnimationSet()
  75. {
  76.     clearAnimations();
  77.     bStarted = false;
  78.     bFound = false
  79.  
  80.     // Determine the next sequence number
  81.     divElements = document.all.tags("DIV");
  82.     for (index = 0; index < divElements.length; index++)
  83.     {
  84.         el = divElements[index];
  85.         
  86.         objectOrder = el.getAttribute("BSSCObjectOrder", false);
  87.         if(null != objectOrder)
  88.         {
  89.             objectOrder = parseInt(objectOrder);
  90.             if (objectOrder > BSSCSequenceIndex && (!bFound || objectOrder < minBSSCSequenceIndexFound))
  91.             {
  92.                 minBSSCSequenceIndexFound = objectOrder;
  93.                 bFound = true;
  94.             }
  95.                 
  96.         }
  97.     }
  98.  
  99.     if (bFound)
  100.     {
  101.         BSSCSequenceIndex = minBSSCSequenceIndexFound;
  102.         bStarted = startAnimationSet(BSSCSequenceIndex);
  103.     }
  104. }
  105.  
  106. function getOffsetFromTopOfBrowser(el)
  107. {
  108.     if (null == el.offsetParent)
  109.         return el.offsetTop;
  110.     else
  111.         return el.offsetTop + getOffsetFromTopOfBrowser(el.offsetParent);
  112. }
  113.  
  114. function startAnimationSet(ndx)
  115. {
  116.     animationContextIndex = 0;
  117.     bStarted = false;
  118.  
  119.     // Find document elements with "BSSCAnimationType" attribute
  120.     divElements = document.all.tags("DIV");
  121.     for (index = 0; index < divElements.length; index++)
  122.     {
  123.         el = divElements[index];
  124.         
  125.         animationType = el.getAttribute("BSSCAnimationType", false);
  126.         if(null != animationType)
  127.         {
  128.             framePeriod = el.getAttribute("BSSCFramePeriod", false);
  129.             frameCount = el.getAttribute("BSSCFrameCount", false);
  130.             sequenceIndex = el.getAttribute("BSSCObjectOrder", false);
  131.  
  132.             // Stop any currently running RevealTrans filters
  133.             if ("RevealTrans" == animationType && parseInt(sequenceIndex) == ndx-1)
  134.                 el.filters.RevealTrans.stop();  
  135.  
  136.             // Filter on ndx
  137.             if (0 == ndx && null == sequenceIndex ||
  138.                 ndx == parseInt(sequenceIndex))
  139.             {
  140.                 if ("FlyInFromRight" == animationType)
  141.                 {
  142.                     animationDuration = el.getAttribute("BSSCDuration", false);
  143.                     if (null == animationDuration)
  144.                         animationDuration = 1000; // default to 1s
  145.                     animationContexts[animationContextIndex] = new animationContext(el, progressTranslation, finishTranslation, animationDuration, 10);
  146.                     animationContexts[animationContextIndex].startX = document.body.clientWidth;
  147.                     animationContexts[animationContextIndex].startY = 0;
  148.                     animationContexts[animationContextIndex].finalX = 0;
  149.                     animationContexts[animationContextIndex].finalY = 0;
  150.                     animationPump(animationContextIndex++);
  151.                     bStarted = true;
  152.                 }
  153.  
  154.                 if ("FlyInFromLeft" == animationType)
  155.                 {
  156.                     animationDuration = el.getAttribute("BSSCDuration", false);
  157.                     if (null == animationDuration)
  158.                         animationDuration = 1000; // default to 1s
  159.                     for (childIndex=0; childIndex<el.children.length; childIndex++)
  160.                     {
  161.                         if ("left" == el.children[childIndex].style.textAlign)
  162.                             el.children[childIndex].style.textAlign = "right";
  163.                     }
  164.                     pixelsToTranslate = document.body.clientWidth;
  165.                     animationContexts[animationContextIndex] = new animationContext(el, progressTranslation, finishTranslation, animationDuration, 10);
  166.                     animationContexts[animationContextIndex].startX = -document.body.clientWidth;
  167.                     animationContexts[animationContextIndex].startY = 0;
  168.                     animationContexts[animationContextIndex].finalX = 0;
  169.                     animationContexts[animationContextIndex].finalY = 0;
  170.                     animationPump(animationContextIndex++);
  171.                     bStarted = true;
  172.                 }
  173.                 
  174.                 if ("FlyInFromBottom" == animationType)
  175.                 {
  176.                     animationDuration = el.getAttribute("BSSCDuration", false);
  177.                     if (null == animationDuration)
  178.                         animationDuration = 1000; // default to 1s
  179.                     animationContexts[animationContextIndex] = new animationContext(el, progressTranslation, finishTranslation, animationDuration, 10);
  180.                     animationContexts[animationContextIndex].startX = 0;
  181.                     animationContexts[animationContextIndex].startY = document.body.clientHeight - el.offsetTop;
  182.                     animationContexts[animationContextIndex].finalX = 0;
  183.                     animationContexts[animationContextIndex].finalY = 0;
  184.                     animationPump(animationContextIndex++);
  185.                     bStarted = true;
  186.                 }
  187.  
  188.                 if ("FlyInFromTop" == animationType)
  189.                 {
  190.                     animationDuration = el.getAttribute("BSSCDuration", false);
  191.                     if (null == animationDuration)
  192.                         animationDuration = 1000; // default to 1s
  193.                     animationContexts[animationContextIndex] = new animationContext(el, progressTranslation, finishTranslation, animationDuration, 10);
  194.                     animationContexts[animationContextIndex].startX = 0;
  195.                     animationContexts[animationContextIndex].startY = -getOffsetFromTopOfBrowser(el) - el.offsetHeight;
  196.                     animationContexts[animationContextIndex].finalX = 0;
  197.                     animationContexts[animationContextIndex].finalY = 0;
  198.                     animationPump(animationContextIndex++);
  199.                     bStarted = true;
  200.                 }
  201.  
  202.  
  203.                 if ("FlyInFromBottomRight" == animationType)
  204.                 {
  205.                     animationDuration = el.getAttribute("BSSCDuration", false);
  206.                     if (null == animationDuration)
  207.                         animationDuration = 1000; // default to 1s
  208.                     pixelsToTranslate = document.body.clientWidth;
  209.                     if (document.body.clientHeight - el.offsetTop < pixelsToTranslate)
  210.                         pixelsToTranslate = document.body.clientHeight - el.offsetTop;
  211.                     animationContexts[animationContextIndex] = new animationContext(el, progressTranslation, finishTranslation, animationDuration, 10);
  212.                     animationContexts[animationContextIndex].startX = pixelsToTranslate;
  213.                     animationContexts[animationContextIndex].startY = pixelsToTranslate;
  214.                     animationContexts[animationContextIndex].finalX = 0;
  215.                     animationContexts[animationContextIndex].finalY = 0;
  216.                     animationPump(animationContextIndex++);
  217.                     bStarted = true;
  218.                 }
  219.  
  220.                 if ("FlyInFromTopRi